//
//  CollectionViewCellOfChannelAccess.m
//  UI_homework_22_QQ音乐界面和阿里星球界面
//
//  Created by li cheng on 16/8/13.
//  Copyright © 2016年 li cheng. All rights reserved.
//

#import "CollectionViewCellOfChannelAccess.h"

@interface CollectionViewCellOfChannelAccess()

@end
@implementation CollectionViewCellOfChannelAccess
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        _myImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:_myImageView];
        _myImageView.backgroundColor = [UIColor orangeColor];
        _myLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_myLabel];
        _myLabel.backgroundColor = [UIColor greenColor];
    }
    return self;
}
- (void)layoutSubviews{
    [super layoutSubviews];
    CGFloat widthOfImageView = self.contentView.bounds.size.width * 3 / 5;
    CGFloat heightOfImageView = widthOfImageView;
    CGFloat widthOfLabel = widthOfImageView;
    CGFloat heightOLabel = self.contentView.bounds.size.height - heightOfImageView;
    CGFloat edge = (self.contentView.bounds.size.width - widthOfImageView) / 2;
    _myImageView.frame = CGRectMake(edge, 0, widthOfImageView, heightOfImageView);
    _myLabel.frame = CGRectMake(edge, heightOfImageView, widthOfLabel, heightOLabel);
}
@end
